package com.itheima.mapper;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
    /**
     * 根据用户名查询用户
     * @param username
     * @return
     */
    @Select("select * from user where username = #{username}")
    User SelectByUsername(String username);

    /**
     * 根据用户id查询角色权限
     * @param id
     * @return
     */
     @Select("select r.keyword " +
             "from role r, user_role ur " +
             "where r.id = ur.role_id and ur.user_id = #{id}")
    List<String> getRoleKeysById(Integer id);
}
